package com.LFLWZ.serviceImpl;

import com.LFLWZ.beans.POJO.ScandalUser;
import com.LFLWZ.mapper.ScandalUserMapper;
import com.LFLWZ.service.ScandalUserService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 个人信息表(ScandalUser)表服务实现类
 *
 * @author lujum
 * @since 2020-11-29 15:26:52
 */
@Service
public class ScandalUserServiceImpl implements ScandalUserService {

    @Autowired
    private ScandalUserMapper scandalUserMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ScandalUser queryById(Integer id) {
        return this.scandalUserMapper.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<ScandalUser> queryAllByLimit(int offset, int limit) {
        return this.scandalUserMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param scandalUser 实例对象
     * @return 实例对象
     */
    @Override
    public ScandalUser insert(ScandalUser scandalUser) {
        this.scandalUserMapper.insert(scandalUser);
        return scandalUser;
    }

    /**
     * 修改数据
     *
     * @param scandalUser 实例对象
     * @return 实例对象
     */
    @Override
    public ScandalUser update(ScandalUser scandalUser) {
        this.scandalUserMapper.update(scandalUser);
        return this.queryById(scandalUser.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.scandalUserMapper.deleteById(id) > 0;
    }


    /**
     * 通过实体作为筛选条件查询
     *
     * @param scandalUser 实例对象
     * @return 对象列表
     */
    @Override
    public List<ScandalUser> queryAll(ScandalUser scandalUser){
        return scandalUserMapper.queryAll(scandalUser);
    }
}